#!/usr/local/bin/python 

num = int(raw_input(""))
for i in xrange(num):
    a,b,c,d = tuple(int(i) for i in raw_input('').split())
    print c,b+d
    print a,b+d
